{include file="public/header" /}

<body style="background-color: #ffffff">
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label for="L_choose_name" class="layui-form-label">
                        <span class="x-red">*</span>用户手机号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="mobile" name="mobile" required="" lay-verify="required"
                            autocomplete="off" class="layui-input" value="" placeholder="请输入手机号">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_choose_name" class="layui-form-label">
                        <span class="x-red">*</span>合约等级</label>
                    <div class="layui-input-inline">
                        <select name="id">
                            {foreach $contract as $uc}
                            <option value="{$uc.id}">{$uc.name}</option>
                            {/foreach}

                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_choose_name" class="layui-form-label">
                        <span class="x-red">*</span>合约面值</label>
                    <div class="layui-input-inline">
                        <input type="number" id="money" name="money" required="" lay-verify="required"
                            autocomplete="off" class="layui-input" value="" placeholder="请输入合约面值">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_choose_name" class="layui-form-label">
                        <span class="x-red">*</span>合约数量</label>
                    <div class="layui-input-inline">
                        <input type="number" id="number" name="number" required="" lay-verify="required"
                            autocomplete="off" class="layui-input" value="1" placeholder="请输入合约数量">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <button class="layui-btn" lay-filter="add" lay-submit="">提交</button>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <button type="button" class="layui-btn layui-btn-primary" onclick="IframeClose()">取消</button>

                </div>
            </form>
        </div>
    </div>

    {include file="public/footer" /}
    <script src="/static/leyedit/Layui-KnifeZ/layui.js"></script>
    <script src="/static/leyedit/ace/ace.js"></script>
    <script>
        layui.use(['layer', 'jquery', 'form'], function () {
            $ = layui.jquery;
            var form = layui.form
                , layer = layui.layer;
            //监听提交
            form.on('submit(add)', function (data) {
                //发异步，把数据提交给php
                $.ajax({
                    'type': 'post',
                    data: data.field,
                    success: function (res) {
                        if (res.status == 0) {
                            layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.location.reload();
                                parent.layer.close(index);
                            });
                        } else {
                            layer.msg(res.msg, { icon: 2, time: 1000 });
                        }
                    }
                });
                return false;
            });
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#dates' //指定元素
            });
        });
    </script>

</body>

</html>